package baby.feixin.os;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

import org.apache.log4j.Logger;

public class MainService {
	
	private static  Logger logger = Logger.getLogger(MainService.class);
	
	public static void main(String[] args) {
		new MainService().startService();
	}
	
	public void startService()
	{
		new Thread(){
			public void run() {
				startService2();
			};
		}.start();
	}
	
	private void startService2()
	{
		Timer timer = new Timer();
		long period = 1000*60*60;
		timer.schedule(getTask(), new Date(), Long.valueOf(period));
		
	}
	
	
	public static TimerTask getTask(){
		return new TimerTask() {
			
			@Override
			public void run() {
				// TODO Auto-generated method stub
				logger.info("--begin--"+new Date());
				
				FeiNet feiNet =new  FeiNet();
				feiNet.startService();
							
				logger.info("----end---"+new Date());
			}
		};
	}
	
	
}
